Skip to content

Conversation

@Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Jul 29, 2025

From #149876 (comment): The name() accessor checked for m_kind == Union and accessed cvclass instead of cvunion. This is technically wrong (maybe UB even?).
In practice, this wasn't an issue, because all types in the union (ClassRecord/EnumRecord/UnionRecord) inherit from TagRecord.

@Nerixyz Nerixyz requested a review from JDevlieghere as a code owner July 29, 2025 17:23
@llvmbot llvmbot added the lldb label Jul 29, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 29, 2025

@llvm/pr-subscribers-lldb

Author: nerix (Nerixyz)

Changes

From #149876 (comment): The name() accessor checked for m_kind == Union and accessed cvclass instead of cvunion. This is technically wrong (maybe UB even?).
In practice, this wasn't an issue, because all types in the union (ClassRecord/EnumRecord/UnionRecord) inherit from TagRecord.


Full diff: https://github.com/llvm/llvm-project/pull/151190.diff

1 Files Affected:

  • (modified) lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h (+1-1)
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
index 1f888f4de1fed..98b965c361a77 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
@@ -65,7 +65,7 @@ struct CVTagRecord {
   }
 
   llvm::StringRef name() const {
-    if (m_kind == Struct || m_kind == Union)
+    if (m_kind == Struct || m_kind == Class)
       return cvclass.Name;
     if (m_kind == Enum)
       return cvenum.Name;

@JDevlieghere JDevlieghere merged commit 6be3cc5 into llvm:main Jul 30, 2025
11 checks passed
@Nerixyz Nerixyz deleted the fix/lldb-pdbutil-check branch November 7, 2025 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants